package com.ferry.registry.domain.service;

import java.util.Objects;

/**
 * Created by daiyong
 * 注册地址
 */
public class ServiceAddress {
	private String ip;
	private int port;

	public ServiceAddress(String ip, int port) {
		this.ip = ip;
		this.port = port;
	}

	public String getIp() {
		return ip;
	}

	public void setIp(String ip) {
		this.ip = ip;
	}

	public int getPort() {
		return port;
	}

	public void setPort(int port) {
		this.port = port;
	}

	@Override
	public boolean equals(Object o) {
		if (this == o) return true;
		if (o == null || getClass() != o.getClass()) return false;
		ServiceAddress serviceAddress = (ServiceAddress) o;
		return port == serviceAddress.port &&
				Objects.equals(ip, serviceAddress.ip);
	}

	@Override
	public int hashCode() {
		return Objects.hash(ip, port);
	}

	@Override
	public String toString() {
		return "ServiceAddress{" +
				"ip='" + ip + '\'' +
				", port=" + port +
				'}';
	}
}
